package infi.hexin.logback;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import org.slf4j.LoggerFactory;


/**
 * Created by infi.he on 2015/4/9.
 */
public class LogBackMain {
    static org.slf4j.Logger log = LoggerFactory.getLogger("info.hexin.storagelimit");

    public static void main(String[] args) {
        log.info("tttttttttttttttttttttttttttttttttttttttttttttttt");
        log.error("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
        Thread thread = new Thread() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(2000);
                        log.info("ttttttttttttttttttttttttttttttt");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        thread.start();
        try {
            Thread.sleep(10000);
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            Logger logger = lc.getLogger("info.hexin.storagelimit");
            logger.setLevel(Level.ERROR);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
